package com.pifuke.patient;

import java.util.ArrayList;

import org.json.JSONObject;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.TextView;

import com.evan.common.pullrefresh.PullToRefreshBase;
import com.evan.common.pullrefresh.PullToRefreshBase.OnRefreshListener;
import com.pifuke.patient.ui.SymptomQuestionView;
import com.smiier.skin.QuestionDetailActivity;
import com.smiier.skin.adapter.QuestionAdapter;
import com.smiier.skin.constant.Constant;
import com.smiier.skin.ui.BasicActivity;
import com.smiier.skin.util.GlobalSettings;
import com.umeng.analytics.MobclickAgent;

public class KepuXiangguanzixunActivitiy extends BasicActivity implements
		OnRefreshListener<ListView>, OnItemClickListener {
	
	private TextView zixun_title;
	private ListView list_more_zixun;
	
	QuestionAdapter adapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		this.setContentView(R.layout.activity_xiangguan_zixun_view);
		init();
		setNavTitle("咨询相关");
		
		list_more_zixun = findViewById(R.id.list_more_zixun,ListView.class);
		zixun_title = findViewById(R.id.zixun_title,TextView.class);
		
		zixun_title.setText("以下是有关 \" "+GlobalSettings.symptomItemInfo.Patient_Name+"\"的咨询项目");
		
		
		adapter = new QuestionAdapter(
				(Activity) getContext(),
				SymptomQuestionView.array);
		
		list_more_zixun.setAdapter(adapter);
		
	}
	
	

	@Override
	protected void onStart() {
		super.onStart();
		
		
		list_more_zixun.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> adapterView, View view,
					int arg2, long arg3) {

				JSONObject object = (JSONObject) view.getTag(R.id.tag_obj);
				Intent intent = new Intent(getContext(),
						QuestionDetailActivity.class);
				intent.putExtra(Constant.IDENTITY_KEY, object.toString());
				startActivity(intent);

			}
		});
	}



	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		// TODO Auto-generated method stub
		
		
	}

	@Override
	public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onPullUpToLoadMore(PullToRefreshBase<ListView> refreshView) {
		// TODO Auto-generated method stub
		
	}

	
	
/*	@Override
	protected void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
	}

	@Override
	protected void onPause() {
		super.onPause();
		
		MobclickAgent.onPause(this);
	}
	*/
	
	
	
	
}
